package com.study.stack;

import java.util.Scanner;

/**
 * - *@ClassName StackTest
 * - *@Author LiuHuaBing
 * - *@Date 2021/11/30 10:44
 * - *@Version 1.0
 * - 测试提交 1-1*2*3-3   7+2*6-4
 */
public class StackTest {

    public static void main(String[] args) {
        Calculator calculator =new Calculator();

        int result = calculator.calculate("7*2*2-5+1-5+3-4");
        System.out.println(result);


        ArrayStack arrayStack = new ArrayStack(4);

        Scanner scanner = new Scanner(System.in);

        Boolean loop = true;
        while (loop){
            System.out.println("p: getElement");
            System.out.println("a: addElement");
            System.out.println("s: showStack");
            System.out.println("e: exitProgram");
            String key = scanner.next();
            switch (key){
                case "p":
                    arrayStack.pop();
                    break;
                case "a":
                    System.out.println("please input the element that you want");
                    int next = scanner.nextInt();
                    arrayStack.push(next);
                    break;
                case "s":
                    arrayStack.list();
                    break;
                case "e":
                    loop =false;
                    break;
            }

        }
        System.out.println("this program exit success");
    }
}
